package com.enlorenz.common.geo.analyzer.hotspot.imp;

import java.util.ArrayList;
import java.util.List;

import com.enlorenz.common.geo.analyzer.hotspot.AbstractHotSpotAnalyzer;
import com.enlorenz.common.geo.analyzer.hotspot.HotSpotDetails;
import com.enlorenz.common.geo.base.DefaultPoint;
import com.enlorenz.common.geo.base.IPoint;

/**
 * 默认实现的热点分析
 * 需要传入pointList，会自动对列表进行分类，单不会区分点的类型
 * 然后累计不同范围点的数量，并缓存点的具体数据
 * @author lcb
 */
public class HotSpotAnalyzer extends AbstractHotSpotAnalyzer{
	private List<IPoint> pointList;
	public void setPointList(List<IPoint> pointList) {
		this.pointList = pointList;
	}
	
	
	protected void addDetailsOne(HotSpotDetails details,IPoint point){
		AllPointsHotSpotDetails aphsd=(AllPointsHotSpotDetails)details;
		aphsd.getPointList().add(point);
	}
	
	protected HotSpotDetails createHotSpotDetails(IPoint point){
		return new AllPointsHotSpotDetails();
	}

	@Override
	protected List<IPoint> getPointList() {
		return pointList;
	}

	@Override
	protected String getPointUniKey(IPoint point) {
		return point.getClass().getSimpleName();
	}
	
	public static void main(String[] args) {
		HotSpotAnalyzer hsa=new HotSpotAnalyzer();
		List<IPoint> pointList=new ArrayList<IPoint>();
		pointList.add(new DefaultPoint(112.1,23.1));
		pointList.add(new DefaultPoint(112.1,23.1));
		pointList.add(new DefaultPoint(112.1,23.1));
		pointList.add(new DefaultPoint(112.2,23.1));
		pointList.add(new DefaultPoint(112.2,23.1));
		pointList.add(new DefaultPoint(112.3,23.1));
		pointList.add(new DefaultPoint(112.3,23.1));
		pointList.add(new DefaultPoint(112.3,23.1));
		hsa.setPointList(pointList);
		System.out.println(hsa.getHotspotList());
	}
	
}
